Skip to content

ESO-447: Expand Vault e2e for TLS trustedCABundle and ExternalSecret templating - #169

Open
bharath-b-rh wants to merge 1 commit into
openshift:mainfrom
bharath-b-rh:eso-447
Open

ESO-447: Expand Vault e2e for TLS trustedCABundle and ExternalSecret templating#169
bharath-b-rh wants to merge 1 commit into
openshift:mainfrom
bharath-b-rh:eso-447

Conversation

@bharath-b-rh

@bharath-b-rh bharath-b-rh commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Convert Vault e2e to HTTPS via Red Hat cert-manager Operator (OLM install in root BeforeAll) with a real CA→server cert chain for trustedCABundle validation.
  • Cover trustedCABundle switch (sample CA → Vault CA), SecretStore InvalidProviderConfig→Ready, PushSecret/ExternalSecret sync, and ExternalSecret templating merge (Kubernetes + Vault dockerconfig).
  • Add trustedCABundle watch-label restore coverage; document labels/prereqs.

Test plan

  • make test-e2e E2E_GINKGO_LABEL_FILTER="!(Feature: containsAny {Proxy, Upgrade})"
Ran 53 of 58 Specs in 496.973 seconds
SUCCESS! -- 53 Passed | 0 Failed | 0 Pending | 5 Skipped
--- PASS: TestE2E (497.00s)
PASS
ok  	github.com/openshift/external-secrets-operator/test/e2e	497.027s

Summary by CodeRabbit

  • New Features

    • Added end-to-end coverage for Vault over TLS, certificate management, trusted CA bundles, secret templating, and merged registry credentials.
    • Added cert-manager setup and validation for secure Vault connectivity.
    • Added validation that trusted CA configuration is restored after accidental label removal.
  • Documentation

    • Expanded E2E guidance with Vault providers, feature filters, prerequisites, and test scenarios.
  • Tests

    • Improved readiness checks, resource cleanup, and dynamic resource handling for more reliable integration testing.

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: LGTM mode

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Jul 25, 2026
@openshift-ci-robot

openshift-ci-robot commented Jul 25, 2026

Copy link
Copy Markdown

@bharath-b-rh: This pull request references ESO-447 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "5.0.0" version, but no target version was set.

Details

In response to this:

Summary

  • Convert Vault e2e to HTTPS via Red Hat cert-manager Operator (OLM install in root BeforeAll) with a real CA→server cert chain for trustedCABundle validation.
  • Cover trustedCABundle switch (sample CA → Vault CA), SecretStore InvalidProviderConfig→Ready, PushSecret/ExternalSecret sync, and ExternalSecret templating merge (Kubernetes + Vault dockerconfig).
  • Add trustedCABundle watch-label restore coverage; document labels/prereqs and exclude Provider:Vault from the default e2e filter.

Test plan

  • make test-e2e E2E_GINKGO_LABEL_FILTER="!(Feature: containsAny {Proxy, Upgrade})"
Ran 53 of 58 Specs in 496.973 seconds
SUCCESS! -- 53 Passed | 0 Failed | 0 Pending | 5 Skipped
--- PASS: TestE2E (497.00s)
PASS
ok  	github.com/openshift/external-secrets-operator/test/e2e	497.027s

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@coderabbitai

coderabbitai Bot commented Jul 25, 2026

Copy link
Copy Markdown

Walkthrough

The E2E suite installs cert-manager through OLM, provisions TLS-enabled Vault resources, tests trusted CA recovery, validates merged Kubernetes and Vault registry credentials, and updates supporting utilities and documentation.

Changes

Vault E2E coverage

Layer / File(s) Summary
Cert-manager installation and readiness
test/e2e/cert_manager_helpers_test.go, test/e2e/e2e_test.go, test/e2e/testdata/cert-manager/*, test/e2e/README.md
Installs cert-manager through OLM when required and waits for operand pods and the Certificate API.
Vault TLS provisioning and operation
test/e2e/e2e_test.go, test/e2e/testdata/vault/{issuer,ca_*,certificate,vault}.yaml
Creates cert-manager Issuer and Certificate resources. Vault uses the resulting TLS Secret for HTTPS operation.
Trusted CA and secret synchronization
test/e2e/e2e_test.go, test/e2e/trusted_ca_bundle_test.go, test/e2e/testdata/vault/{external_secret,push_*}.yaml
Tests trusted CA failure and recovery, PushSecret and ExternalSecret synchronization, and watch-label restoration.
Kubernetes and Vault templating
test/e2e/e2e_test.go, test/e2e/testdata/vault/templating_*.yaml
Merges Kubernetes and Vault dockerconfigjson data and verifies both registry entries.
E2E utilities and documentation
test/e2e/README.md, Makefile, test/utils/{conditions,dynamic_resources}.go
Documents labels and prerequisites, generalizes condition polling, and adds replacement-aware deletion.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant E2ETests
  participant CertManager
  participant Kubernetes
  participant Vault
  participant ExternalSecretsOperator
  E2ETests->>CertManager: create Issuer and Certificate resources
  CertManager->>Kubernetes: create CA and TLS Secrets
  E2ETests->>Vault: deploy and initialize HTTPS Vault
  E2ETests->>ExternalSecretsOperator: configure trustedCABundle and SecretStores
  ExternalSecretsOperator->>Vault: read and write secret data
  ExternalSecretsOperator->>Kubernetes: reconcile merged ExternalSecret
  E2ETests->>Kubernetes: verify readiness and registry entries
Loading

Suggested reviewers: siddhibhor-56, mytreya-rh


Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 error, 3 warnings)

Check name Status Explanation Resolution
No-Sensitive-Data-In-Logs ❌ Error WaitForESOResourceCondition prints arbitrary ESO condition messages; Vault TLS errors can include the internal vault.vault-test.svc.cluster.local endpoint. Do not print provider condition messages or command output directly. Redact URLs, credentials, and other sensitive fields before logging failures.
Test Structure And Quality ⚠️ Warning The Vault It combines CA failure/recovery, SecretStore, PushSecret, and ExternalSecret behaviors; many new Expect calls lack messages, and cert-manager installation has no cleanup path. Split the compound Vault scenario into focused It blocks, add meaningful messages to all new assertions, and clean up cert-manager resources when the test installs them.
Microshift Test Compatibility ⚠️ Warning The new root BeforeAll unconditionally applies OLM OperatorGroup and Subscription resources from operator.yaml; no MicroShift skip, API-group tag, or runtime guard protects the tests. Guard the cert-manager OLM setup and dependent specs on MicroShift, or add an appropriate operators.coreos.com/[Skipped:MicroShift] exclusion before the setup runs.
Ipv6 And Disconnected Network Test Compatibility ⚠️ Warning The new Vault HTTPS path uses https://127.0.0.1:8200 and binds 0.0.0.0:8200; its default Vault images also use public registries. Use IPv6-safe or dual-stack binding and ::1, mirror images or require an internal override, then run /payload-job periodic-ci-openshift-release-master-nightly-4.22-e2e-metal-ipi-ovn-ipv6.
✅ Passed checks (11 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main changes: expanded Vault E2E coverage for TLS, trustedCABundle, and ExternalSecret templating.
Docstring Coverage ✅ Passed Docstring coverage is 80.95% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed All PR-added Ginkgo titles are static string literals; runtime namespaces, pod names, and random identifiers remain in test bodies, not titles.
Single Node Openshift (Sno) Test Compatibility ✅ Passed Added tests wait for named pods and resources; they do not count nodes, require distinct-node scheduling, use anti-affinity/topology spread, or test HA, failover, drain, scaling, or multi-endpoint...
Topology-Aware Scheduling Compatibility ✅ Passed The PR adds no topology-sensitive scheduling constraints. Vault's existing single replica and architecture affinity are unchanged; no anti-affinity, spread, control-plane/worker selectors, broad to...
Ote Binary Stdout Contract ✅ Passed No OTE binary or process-level stdout write was added; suite setup uses GinkgoWriter, and direct fmt.Printf calls remain in a test utility helper.
No-Weak-Crypto ✅ Passed The PR uses crypto/rand with ECDSA P-256 and cert-manager RSA 2048; no MD5, SHA1, DES, RC4, 3DES, Blowfish, ECB, custom crypto, or secret comparisons were added.
Container-Privileges ✅ Passed Changed manifests contain no privileged:true, hostPID, hostNetwork, hostIPC, or SYS_ADMIN. Vault runs as non-root with privilege escalation disabled and all capabilities dropped.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.12.2)

Error: build linters: unable to load custom analyzer "kubeapilinter": bin/kube-api-linter.so, plugin: not implemented
The command is terminated due to an error: build linters: unable to load custom analyzer "kubeapilinter": bin/kube-api-linter.so, plugin: not implemented


Comment @coderabbitai help to get the list of available commands.

@openshift-ci

openshift-ci Bot commented Jul 25, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bharath-b-rh

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 25, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🧹 Nitpick comments (3)
test/e2e/cert_manager_helpers_test.go (1)

109-141: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Prefer k8serrors.IsNotFound over string matching.

strings.Contains(err.Error(), "not found") is fragile compared to the structured k8serrors.IsNotFound(err) check used elsewhere in this PR (e.g. ensureVaultNamespace). Text matching can silently misclassify errors if the message format changes.

♻️ Proposed fix
 		pods, err := clientset.CoreV1().Pods(certManagerOperandNamespace).List(ctx, metav1.ListOptions{})
 		if err != nil {
-			if strings.Contains(err.Error(), "not found") {
+			if k8serrors.IsNotFound(err) {
 				return false, nil
 			}
 			return false, err
 		}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/e2e/cert_manager_helpers_test.go` around lines 109 - 141, Update
waitForCertManagerOperandPods to use the Kubernetes structured not-found check
k8serrors.IsNotFound(err) instead of matching "not found" in err.Error(), while
preserving the existing retry behavior for not-found errors and propagation of
all other errors.
test/e2e/e2e_test.go (1)

2759-2816: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Wrap ConfigMap update with retry.RetryOnConflict.

createVaultCAConfigMap and createSampleCAConfigMap do a plain Get→mutate .Data→Update without conflict retry. The referenced ConfigMap (vaultCAConfigMapName) is the same object the operator's watch-label reconciler patches once it's referenced by trustedCABundle (per trusted_ca_bundle_test.go's watch-label restoration test), so a concurrent operator patch between our Get and Update can produce a conflict error that isn't retried, unlike the established retry.RetryOnConflict pattern used in setTrustedCABundle/clearTrustedCABundle in this same file.

♻️ Proposed fix (apply the same pattern to both functions)
-	existing, err := clientset.CoreV1().ConfigMaps(operandNamespace).Get(ctx, vaultCAConfigMapName, metav1.GetOptions{})
-	if k8serrors.IsNotFound(err) {
-		_, err = clientset.CoreV1().ConfigMaps(operandNamespace).Create(ctx, cm, metav1.CreateOptions{})
-		return err
-	}
-	if err != nil {
-		return err
-	}
-	existing.Data = cm.Data
-	_, err = clientset.CoreV1().ConfigMaps(operandNamespace).Update(ctx, existing, metav1.UpdateOptions{})
-	return err
+	return retry.RetryOnConflict(retry.DefaultRetry, func() error {
+		existing, err := clientset.CoreV1().ConfigMaps(operandNamespace).Get(ctx, vaultCAConfigMapName, metav1.GetOptions{})
+		if k8serrors.IsNotFound(err) {
+			_, err = clientset.CoreV1().ConfigMaps(operandNamespace).Create(ctx, cm, metav1.CreateOptions{})
+			return err
+		}
+		if err != nil {
+			return err
+		}
+		existing.Data = cm.Data
+		_, err = clientset.CoreV1().ConfigMaps(operandNamespace).Update(ctx, existing, metav1.UpdateOptions{})
+		return err
+	})
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/e2e/e2e_test.go` around lines 2759 - 2816, Wrap the existing ConfigMap
Get, Data mutation, and Update flow in both createVaultCAConfigMap and
createSampleCAConfigMap with retry.RetryOnConflict, re-fetching the ConfigMap on
each retry and returning non-conflict errors immediately. Preserve the existing
create-on-NotFound behavior and ensure the retry callback propagates the final
update error.
test/e2e/trusted_ca_bundle_test.go (1)

236-238: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add failure messages to newly added Gomega assertions. Both sites add new Expect/g.Expect assertions without a descriptive failure message, unlike neighboring assertions in the same PR (e.g. the restoration check a few lines below in the same test) that do include one — this is explicitly called out for **/*_test.go files.

  • test/e2e/trusted_ca_bundle_test.go#L236-L238: add a message to g.Expect(cm.Labels).To(HaveKeyWithValue(...)), e.g. "ConfigMap %s should have the watch label after ExternalSecretsConfig is Ready".
  • test/e2e/e2e_test.go#L2012-L2014: add messages to Expect(createVaultCAConfigMap(...)).To(Succeed()) and Expect(createSampleCAConfigMap(...)).To(Succeed()), e.g. "failed to create Vault CA ConfigMap" / "failed to create sample CA ConfigMap".
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/e2e/trusted_ca_bundle_test.go` around lines 236 - 238, Add descriptive
failure messages to all newly added Gomega assertions: update the ConfigMap
label assertion near the ExternalSecretsConfig readiness check in
test/e2e/trusted_ca_bundle_test.go (lines 236-238), and add distinct
creation-failure messages to the createVaultCAConfigMap and
createSampleCAConfigMap assertions in test/e2e/e2e_test.go (lines 2012-2014).

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@test/e2e/e2e_test.go`:
- Around line 164-167: Remove the suite-level ensureCertManagerOperatorReady
call from the top-level Ordered Describe BeforeAll, and invoke it in the “Vault
Secret Manager” Context’s own BeforeAll near its existing setup. Keep
cert-manager installation scoped to Vault tests, and add the appropriate
MicroShift skip or guard alongside the Context’s existing Skipped:Disconnected
handling.

In `@test/e2e/README.md`:
- Line 155: Move the “Custom Network Policy Naming” paragraph from beneath
trusted_ca_bundle_test.go to the section containing the NetworkPolicy entry for
e2e_test.go. Preserve the paragraph text unchanged and keep it associated with
the NetworkPolicy spec documentation.
- Around line 87-91: The executable default e2e filter must match the documented
exclusion of Vault. Update the default filter in the Makefile target governing
make test-e2e to exclude both Bitwarden and Vault, preserving the existing
behavior for other suites and avoiding changes to the README unless Vault is
intentionally meant to run by default.

In `@test/e2e/testdata/vault/vault.yaml`:
- Around line 51-52: Update the Deployment pod security configuration in
vault.yaml to explicitly set runAsNonRoot and readOnlyRootFilesystem, retain
capability dropping and allowPrivilegeEscalation: false, and disable
service-account token automount unless required. Ensure the /vault/data volume
remains writable while the container root filesystem is read-only.

---

Nitpick comments:
In `@test/e2e/cert_manager_helpers_test.go`:
- Around line 109-141: Update waitForCertManagerOperandPods to use the
Kubernetes structured not-found check k8serrors.IsNotFound(err) instead of
matching "not found" in err.Error(), while preserving the existing retry
behavior for not-found errors and propagation of all other errors.

In `@test/e2e/e2e_test.go`:
- Around line 2759-2816: Wrap the existing ConfigMap Get, Data mutation, and
Update flow in both createVaultCAConfigMap and createSampleCAConfigMap with
retry.RetryOnConflict, re-fetching the ConfigMap on each retry and returning
non-conflict errors immediately. Preserve the existing create-on-NotFound
behavior and ensure the retry callback propagates the final update error.

In `@test/e2e/trusted_ca_bundle_test.go`:
- Around line 236-238: Add descriptive failure messages to all newly added
Gomega assertions: update the ConfigMap label assertion near the
ExternalSecretsConfig readiness check in test/e2e/trusted_ca_bundle_test.go
(lines 236-238), and add distinct creation-failure messages to the
createVaultCAConfigMap and createSampleCAConfigMap assertions in
test/e2e/e2e_test.go (lines 2012-2014).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 30b54f36-5d8e-478d-9d6f-0961fa177082

📥 Commits

Reviewing files that changed from the base of the PR and between 65f39bd and 303aa54.

📒 Files selected for processing (20)
  • Makefile
  • test/e2e/README.md
  • test/e2e/cert_manager_helpers_test.go
  • test/e2e/e2e_test.go
  • test/e2e/testdata/cert-manager/operator.yaml
  • test/e2e/testdata/vault/ca_certificate.yaml
  • test/e2e/testdata/vault/ca_issuer.yaml
  • test/e2e/testdata/vault/certificate.yaml
  • test/e2e/testdata/vault/external_secret.yaml
  • test/e2e/testdata/vault/issuer.yaml
  • test/e2e/testdata/vault/push_secret.yaml
  • test/e2e/testdata/vault/push_source_secret.yaml
  • test/e2e/testdata/vault/templating_external_secret.yaml
  • test/e2e/testdata/vault/templating_k8s_backend.yaml
  • test/e2e/testdata/vault/templating_push_secret.yaml
  • test/e2e/testdata/vault/templating_source_secrets.yaml
  • test/e2e/testdata/vault/vault.yaml
  • test/e2e/trusted_ca_bundle_test.go
  • test/utils/conditions.go
  • test/utils/dynamic_resources.go

Comment thread test/e2e/e2e_test.go
Comment thread test/e2e/README.md
Comment thread test/e2e/README.md Outdated
Comment thread test/e2e/testdata/vault/vault.yaml

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (3)
test/e2e/e2e_test.go (3)

2012-2046: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Add failure messages to the bare Expect(...).To(Succeed()) assertions.

Lines 2013, 2014, 2027, 2030, 2040 and 2043 assert success without a message. The helper errors carry context, but a message states the intent of each step directly in the failure output. Example: .To(Succeed(), "SecretStore %s should report Ready=False with reason %s", secretStoreResourceName, invalidProviderConfigReason).

As per coding guidelines: "Flag Ginkgo test assertions that lack meaningful failure messages."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/e2e/e2e_test.go` around lines 2012 - 2046, Add meaningful failure
messages to each bare Expect(...).To(Succeed()) assertion in this test flow,
including createVaultCAConfigMap, createSampleCAConfigMap, both loader
operations, setTrustedCABundle calls, and the readiness waits. Use messages
describing the intended operation and relevant resource or condition
identifiers, while preserving the existing assertions and cleanup behavior.

Source: Coding guidelines


2682-2722: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Make the error-handling style of ensureVaultNamespace consistent, and add GinkgoHelper().

The function returns error for the Get and Create paths, but it uses Eventually(...).Should(...) in the terminating-namespace path. A failure in that path aborts the spec through Gomega instead of returning an error to the caller. applyVault calls this function and propagates its error, so the two failure modes behave differently.

Also add GinkgoHelper() at the top so Gomega reports the caller line, as clearTrustedCABundle already does at line 2824.

♻️ Proposed change
 func ensureVaultNamespace(ctx context.Context, clientset *kubernetes.Clientset) error {
+	GinkgoHelper()
 	By(fmt.Sprintf("Ensuring namespace %s exists", vaultNamespace))

Alternatively, replace the two Eventually blocks with wait.PollUntilContextTimeout and return the resulting error, so the helper reports every failure through its return value.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/e2e/e2e_test.go` around lines 2682 - 2722, Add GinkgoHelper() at the
start of ensureVaultNamespace, and replace both Eventually(...).Should(...)
blocks in the terminating-namespace branch with context-aware polling that
returns errors. Ensure timeout or polling failures, including namespace deletion
and recreation failures, propagate through ensureVaultNamespace to applyVault
instead of aborting via Gomega.

1978-1978: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider splitting this spec into two It blocks.

The spec asserts two behaviors: trustedCABundle validation (failure with the sample CA, recovery with the Vault CA) and secret synchronization (PushSecret, ExternalSecret, target Secret content). The Context is Ordered, so a second It can reuse the state established by the first. A split gives a precise failure signal when only one behavior breaks.

As per coding guidelines: "Review Ginkgo test code for single responsibility: each test (It block) should test one specific behavior."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/e2e/e2e_test.go` at line 1978, Split the spec into two ordered It
blocks: keep the non-matching and Vault CA trustedCABundle validation/recovery
assertions together in the first, and move PushSecret, ExternalSecret, and
target Secret synchronization/content assertions into the second. Preserve the
existing Ordered Context state so the second test reuses the successful Vault CA
setup.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@test/e2e/e2e_test.go`:
- Around line 2012-2046: Add meaningful failure messages to each bare
Expect(...).To(Succeed()) assertion in this test flow, including
createVaultCAConfigMap, createSampleCAConfigMap, both loader operations,
setTrustedCABundle calls, and the readiness waits. Use messages describing the
intended operation and relevant resource or condition identifiers, while
preserving the existing assertions and cleanup behavior.
- Around line 2682-2722: Add GinkgoHelper() at the start of
ensureVaultNamespace, and replace both Eventually(...).Should(...) blocks in the
terminating-namespace branch with context-aware polling that returns errors.
Ensure timeout or polling failures, including namespace deletion and recreation
failures, propagate through ensureVaultNamespace to applyVault instead of
aborting via Gomega.
- Line 1978: Split the spec into two ordered It blocks: keep the non-matching
and Vault CA trustedCABundle validation/recovery assertions together in the
first, and move PushSecret, ExternalSecret, and target Secret
synchronization/content assertions into the second. Preserve the existing
Ordered Context state so the second test reuses the successful Vault CA setup.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: aefb2d26-aee3-4a85-abd1-cfdae0712a50

📥 Commits

Reviewing files that changed from the base of the PR and between 303aa54 and ae9636f.

📒 Files selected for processing (20)
  • Makefile
  • test/e2e/README.md
  • test/e2e/cert_manager_helpers_test.go
  • test/e2e/e2e_test.go
  • test/e2e/testdata/cert-manager/operator.yaml
  • test/e2e/testdata/vault/ca_certificate.yaml
  • test/e2e/testdata/vault/ca_issuer.yaml
  • test/e2e/testdata/vault/certificate.yaml
  • test/e2e/testdata/vault/external_secret.yaml
  • test/e2e/testdata/vault/issuer.yaml
  • test/e2e/testdata/vault/push_secret.yaml
  • test/e2e/testdata/vault/push_source_secret.yaml
  • test/e2e/testdata/vault/templating_external_secret.yaml
  • test/e2e/testdata/vault/templating_k8s_backend.yaml
  • test/e2e/testdata/vault/templating_push_secret.yaml
  • test/e2e/testdata/vault/templating_source_secrets.yaml
  • test/e2e/testdata/vault/vault.yaml
  • test/e2e/trusted_ca_bundle_test.go
  • test/utils/conditions.go
  • test/utils/dynamic_resources.go
🚧 Files skipped from review as they are similar to previous changes (18)
  • Makefile
  • test/e2e/testdata/vault/issuer.yaml
  • test/e2e/testdata/vault/external_secret.yaml
  • test/e2e/testdata/vault/certificate.yaml
  • test/e2e/testdata/vault/push_secret.yaml
  • test/e2e/testdata/vault/templating_push_secret.yaml
  • test/utils/dynamic_resources.go
  • test/e2e/testdata/vault/templating_external_secret.yaml
  • test/e2e/testdata/vault/push_source_secret.yaml
  • test/e2e/trusted_ca_bundle_test.go
  • test/e2e/testdata/vault/vault.yaml
  • test/e2e/testdata/vault/templating_k8s_backend.yaml
  • test/e2e/testdata/vault/ca_issuer.yaml
  • test/e2e/README.md
  • test/e2e/testdata/vault/ca_certificate.yaml
  • test/e2e/testdata/cert-manager/operator.yaml
  • test/e2e/cert_manager_helpers_test.go
  • test/utils/conditions.go

…templating

Signed-off-by: Bharath B <bhb@redhat.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
test/e2e/e2e_test.go (1)

1978-1986: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider splitting this spec by behavior.

This It asserts four behaviors: trustedCABundle rejection, trustedCABundle recovery, PushSecret synchronization, and ExternalSecret synchronization. A failure in the later stages does not identify which behavior broke. The Context is Ordered, so you can move the PushSecret and ExternalSecret stages into separate It blocks and keep the CA switch in the first block.

Also, externalsecretsConfigFile through targetSecretKey are never reassigned. Declare them with const to match the adjacent templating spec.

As per coding guidelines: "Review Ginkgo test code for single responsibility: each test (It block) should test one specific behavior. Flag tests that assert multiple unrelated behaviors".

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/e2e/e2e_test.go` around lines 1978 - 1986, Split the ordered spec around
its trustedCABundle rejection/recovery, PushSecret synchronization, and
ExternalSecret synchronization behaviors into separate It blocks, keeping the
Vault CA switch in the first block and preserving shared ordered-state setup as
needed. In the spec’s local declarations, change externalsecretsConfigFile,
vaultSecretStoreFile, vaultExternalSecretFile, secretStoreResourceName,
externalSecretResourceName, and targetSecretKey from var entries to const
declarations.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@test/e2e/e2e_test.go`:
- Around line 2227-2240: Add meaningful failure messages to the assertions
inside the Eventually callback: identify mergedSecretName for the Secrets Get
and secret type checks, and identify the expected registry host for each
parsed.Auths HaveKey assertion. Preserve the existing validation behavior and
the current missing-key message.

---

Nitpick comments:
In `@test/e2e/e2e_test.go`:
- Around line 1978-1986: Split the ordered spec around its trustedCABundle
rejection/recovery, PushSecret synchronization, and ExternalSecret
synchronization behaviors into separate It blocks, keeping the Vault CA switch
in the first block and preserving shared ordered-state setup as needed. In the
spec’s local declarations, change externalsecretsConfigFile,
vaultSecretStoreFile, vaultExternalSecretFile, secretStoreResourceName,
externalSecretResourceName, and targetSecretKey from var entries to const
declarations.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 2d4c34a3-f765-4005-82b3-23ee147cf59a

📥 Commits

Reviewing files that changed from the base of the PR and between ae9636f and a20d0d4.

📒 Files selected for processing (20)
  • Makefile
  • test/e2e/README.md
  • test/e2e/cert_manager_helpers_test.go
  • test/e2e/e2e_test.go
  • test/e2e/testdata/cert-manager/operator.yaml
  • test/e2e/testdata/vault/ca_certificate.yaml
  • test/e2e/testdata/vault/ca_issuer.yaml
  • test/e2e/testdata/vault/certificate.yaml
  • test/e2e/testdata/vault/external_secret.yaml
  • test/e2e/testdata/vault/issuer.yaml
  • test/e2e/testdata/vault/push_secret.yaml
  • test/e2e/testdata/vault/push_source_secret.yaml
  • test/e2e/testdata/vault/templating_external_secret.yaml
  • test/e2e/testdata/vault/templating_k8s_backend.yaml
  • test/e2e/testdata/vault/templating_push_secret.yaml
  • test/e2e/testdata/vault/templating_source_secrets.yaml
  • test/e2e/testdata/vault/vault.yaml
  • test/e2e/trusted_ca_bundle_test.go
  • test/utils/conditions.go
  • test/utils/dynamic_resources.go
🚧 Files skipped from review as they are similar to previous changes (18)
  • Makefile
  • test/e2e/testdata/vault/push_source_secret.yaml
  • test/utils/dynamic_resources.go
  • test/e2e/testdata/vault/push_secret.yaml
  • test/e2e/testdata/vault/external_secret.yaml
  • test/e2e/testdata/vault/issuer.yaml
  • test/e2e/testdata/vault/templating_push_secret.yaml
  • test/e2e/testdata/vault/ca_issuer.yaml
  • test/e2e/testdata/vault/ca_certificate.yaml
  • test/e2e/testdata/vault/templating_external_secret.yaml
  • test/e2e/testdata/vault/templating_k8s_backend.yaml
  • test/e2e/testdata/cert-manager/operator.yaml
  • test/utils/conditions.go
  • test/e2e/README.md
  • test/e2e/trusted_ca_bundle_test.go
  • test/e2e/testdata/vault/certificate.yaml
  • test/e2e/testdata/vault/vault.yaml
  • test/e2e/cert_manager_helpers_test.go

Comment thread test/e2e/e2e_test.go
Comment on lines +2227 to +2240
Eventually(func(g Gomega) {
secret, err := clientset.CoreV1().Secrets(vaultNamespace).Get(ctx, mergedSecretName, metav1.GetOptions{})
g.Expect(err).NotTo(HaveOccurred())
g.Expect(secret.Type).To(Equal(corev1.SecretTypeDockerConfigJson))

raw, ok := secret.Data[corev1.DockerConfigJsonKey]
g.Expect(ok).To(BeTrue(), "merged secret missing %s", corev1.DockerConfigJsonKey)

var parsed struct {
Auths map[string]json.RawMessage `json:"auths"`
}
g.Expect(json.Unmarshal(raw, &parsed)).To(Succeed())
g.Expect(parsed.Auths).To(HaveKey(baselineRegistryHost))
g.Expect(parsed.Auths).To(HaveKey(vaultRegistryHost))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Add failure messages to the merge assertions.

The Get error check, the secret type check, and the two HaveKey checks report no context. When the merge template is wrong, the failure output does not name the secret or the missing registry host.

As per coding guidelines: "Flag Ginkgo test assertions that lack meaningful failure messages."

💚 Proposed fix to add assertion messages
 				secret, err := clientset.CoreV1().Secrets(vaultNamespace).Get(ctx, mergedSecretName, metav1.GetOptions{})
-				g.Expect(err).NotTo(HaveOccurred())
-				g.Expect(secret.Type).To(Equal(corev1.SecretTypeDockerConfigJson))
+				g.Expect(err).NotTo(HaveOccurred(), "failed to get merged secret %s/%s", vaultNamespace, mergedSecretName)
+				g.Expect(secret.Type).To(Equal(corev1.SecretTypeDockerConfigJson),
+					"merged secret %s should have type %s", mergedSecretName, corev1.SecretTypeDockerConfigJson)
 
 				raw, ok := secret.Data[corev1.DockerConfigJsonKey]
 				g.Expect(ok).To(BeTrue(), "merged secret missing %s", corev1.DockerConfigJsonKey)
 
 				var parsed struct {
 					Auths map[string]json.RawMessage `json:"auths"`
 				}
-				g.Expect(json.Unmarshal(raw, &parsed)).To(Succeed())
-				g.Expect(parsed.Auths).To(HaveKey(baselineRegistryHost))
-				g.Expect(parsed.Auths).To(HaveKey(vaultRegistryHost))
+				g.Expect(json.Unmarshal(raw, &parsed)).To(Succeed(),
+					"failed to parse %s from merged secret %s", corev1.DockerConfigJsonKey, mergedSecretName)
+				g.Expect(parsed.Auths).To(HaveKey(baselineRegistryHost),
+					"merged auths should contain the Kubernetes backend host %s", baselineRegistryHost)
+				g.Expect(parsed.Auths).To(HaveKey(vaultRegistryHost),
+					"merged auths should contain the Vault backend host %s", vaultRegistryHost)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Eventually(func(g Gomega) {
secret, err := clientset.CoreV1().Secrets(vaultNamespace).Get(ctx, mergedSecretName, metav1.GetOptions{})
g.Expect(err).NotTo(HaveOccurred())
g.Expect(secret.Type).To(Equal(corev1.SecretTypeDockerConfigJson))
raw, ok := secret.Data[corev1.DockerConfigJsonKey]
g.Expect(ok).To(BeTrue(), "merged secret missing %s", corev1.DockerConfigJsonKey)
var parsed struct {
Auths map[string]json.RawMessage `json:"auths"`
}
g.Expect(json.Unmarshal(raw, &parsed)).To(Succeed())
g.Expect(parsed.Auths).To(HaveKey(baselineRegistryHost))
g.Expect(parsed.Auths).To(HaveKey(vaultRegistryHost))
Eventually(func(g Gomega) {
secret, err := clientset.CoreV1().Secrets(vaultNamespace).Get(ctx, mergedSecretName, metav1.GetOptions{})
g.Expect(err).NotTo(HaveOccurred(), "failed to get merged secret %s/%s", vaultNamespace, mergedSecretName)
g.Expect(secret.Type).To(Equal(corev1.SecretTypeDockerConfigJson),
"merged secret %s should have type %s", mergedSecretName, corev1.SecretTypeDockerConfigJson)
raw, ok := secret.Data[corev1.DockerConfigJsonKey]
g.Expect(ok).To(BeTrue(), "merged secret missing %s", corev1.DockerConfigJsonKey)
var parsed struct {
Auths map[string]json.RawMessage `json:"auths"`
}
g.Expect(json.Unmarshal(raw, &parsed)).To(Succeed(),
"failed to parse %s from merged secret %s", corev1.DockerConfigJsonKey, mergedSecretName)
g.Expect(parsed.Auths).To(HaveKey(baselineRegistryHost),
"merged auths should contain the Kubernetes backend host %s", baselineRegistryHost)
g.Expect(parsed.Auths).To(HaveKey(vaultRegistryHost),
"merged auths should contain the Vault backend host %s", vaultRegistryHost)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/e2e/e2e_test.go` around lines 2227 - 2240, Add meaningful failure
messages to the assertions inside the Eventually callback: identify
mergedSecretName for the Secrets Get and secret type checks, and identify the
expected registry host for each parsed.Auths HaveKey assertion. Preserve the
existing validation behavior and the current missing-key message.

Source: Coding guidelines

@openshift-ci

openshift-ci Bot commented Aug 3, 2026

Copy link
Copy Markdown

@bharath-b-rh: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants